package com.ryqg.jiaofu.domain.pagequery.pdfinfo;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
@Getter
@AllArgsConstructor
public enum PageCountEnum {
    ALL("all", "全部"),
    PAGES_1_9("1-9", "1-9页"),
    PAGES_10_19("10-19", "10-19页"),
    PAGES_20_PLUS("20+", "20页以上");

    private final String code;
    private final String desc;

    public static PageCountEnum fromCode(String code) {
        return Arrays.stream(values())
                .filter(e -> e.getCode().equals(code))
                .findFirst()
                .orElse(ALL);
    }

    @Override
    public String toString() {
        return this.code;
    }
}
